<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
export default {
  name: "App",
  watch: {
    $route(to, from) {
      //监听路由，如果不是登录页面，设置tab标签页的name和title
      //防止用户直接输入地址栏访问，tab标签不加载问题
      if (to.path != "/login" && to.path !="/") {
        let obj = {
          name: to.name,
          title: to.meta.title,
        };
        //调用全局vuex方法
        this.$store.commit("addTab", obj);
      }
    },
  },
};
</script>
<style>
html,
body,
#app {
  font-family: "Helvetica Neue", "Hiragino Sans GB", "WenQuanYi Micro Hei",
    "Microsoft Yahei", sans-serif;
  height: 100%;
  padding: 0;
  margin: 0;
  font-size: 15px;
  background-color: rgb(253, 253, 253);
}
a {
  text-decoration: none;
}
</style>
